home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8120 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.1 KB  |  83 lines

  1. Path: pacifica.access.ch!usenet
  2. From: tombeck@usemail.com (Thomas Beck)
  3. Newsgroups: comp.lang.c++
  4. Subject: Please please help a newbie!
  5. Date: 14 Feb 1996 22:41:12 GMT
  6. Organization: Internet Access AG, Zuerich, Switzerland
  7. Message-ID: <4ftoe8$5a2@pacifica.access.ch>
  8. NNTP-Posting-Host: gatezh1-02.access.ch
  9. X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
  10.  
  11. Hi there!
  12.  
  13. It's quite embarrassing to ask those two questions, because they seem 
  14. absolutely stupid (they probably are). Yesterday I started to learn C/C++. I 
  15. bought a 700 pages book with a cd included that has two compilers on it). I 
  16. fully understand the chapter about the types, but the things I program just 
  17. can't be compiled. I extracted the following two problems:
  18.  
  19. ----------- example 1: -------------
  20. int i;
  21. int & a=i;
  22.  
  23. main() {
  24. }
  25. --------------------------------------------
  26.  
  27. This is not compiled, I get the following output with  Symantec C++ 6.11:
  28.  
  29. D:\SC>sc test1.c        
  30.  
  31. sccx test1.c
  32. int & a=i;
  33.     ^
  34. test1.c(2) : Error: '=', ';' or ',' expected
  35.  
  36. --- errorlevel 1
  37.  
  38. The second thing that doesn't work is this:
  39.  
  40. ----------- example 2: -------------
  41. struct abc {
  42.   int i;
  43.   char a;
  44.   void f1() {
  45.   };
  46. };
  47.  
  48. main() {
  49. }
  50. ---------------------------------------------
  51.  
  52. This isn't compiled either, here's the output:
  53.  
  54. D:\SC>sc test2.c
  55.  
  56. sccx test2.c
  57.   void f1() {
  58.             ^
  59. test2.c(4) : Error: illegal type for 'f1' member
  60.  
  61. --- errorlevel 1
  62.  
  63.  
  64. Before you think I'm absolutely stupid... I used to be very good at Pascal 
  65. (TP 6.0), and I'm also experienced in OOP under Pascal. I have no clue of 
  66. C++, however, and I can only rely on what's written in that book. Apparently 
  67. it doesn't tell me the truth, does it?
  68.  
  69. Can you please help me with those two problems (referenced variable and 
  70. function within a class), so that I can go on and learn a few more difficult 
  71. things?
  72.  
  73. Thanks in advance,
  74.  
  75. Thomas Beck, tombeck@usemail.com
  76.  
  77. =================================================================
  78. Summer's day, as she passed away. Birds were singing in the
  79. summer sky; then came the rain, and once again, a tear fell
  80. from her mother's eye...
  81. =================================================================
  82.  
  83.